package j3dscene;

import j3dscene.models.Drums;

/**
 * Animation class which calls the animation methods from the corresponding
 * object
 *
 * @author Dominik K.
 * @author Steffen G.
 */
public abstract class Animator {

    private static Drums drums;
     /**
     * Neccessary for playing sounds from file (eg. snare punch).
     */
    private static Sound s;
    
    /**
     * set the needed object references
     *
     * @param drums
     */
    public static void init(Drums drums) {
        Animator.drums = drums;
        Animator.s = new Sound();
    }

    /**
     * lets the drumset rotate by 360 Degrees
     */
    public static void turnDrums() {
        drums.getSceneGroup().detach();
        drums.turnDrums();
        Screen.getObjectRoot().addChild(drums.getSceneGroup());

    }
    
    /**
     * animates the pedal of the drumset
     */
    public static void animatePedal() {
        s.playSound(2);
        drums.getSceneGroup().detach();
        drums.animatePedal();
        Screen.getObjectRoot().addChild(drums.getSceneGroup());

    }

    /**
     * animates the hihat of the drumset
     */
    public static void animateHihat() {
        s.playSound(4);
        drums.getSceneGroup().detach();
        drums.animateHihat();
        Screen.getObjectRoot().addChild(drums.getSceneGroup());
    }

    /**
     * animates the crash of the drumset
     */
    public static void animateCrash() {
        s.playSound(5);
        drums.getSceneGroup().detach();
        drums.animateCymbals("CrashCymbal");
        Screen.getObjectRoot().addChild(drums.getSceneGroup());
    }

    /**
     * animates the ride of the drumset
     */
    public static void animateRide() {
        s.playSound(6);
        drums.getSceneGroup().detach();
        drums.animateCymbals("RideCymbal");
        Screen.getObjectRoot().addChild(drums.getSceneGroup());
    }
    /**
     * plays Sound for Snare
     */
    public static void playSnare() {
        s.playSound(1);
    }
    /**
     * plays Sound for OpenHihat
     */
    public static void animateHiHatOpen() {
        s.playSound(3);
        drums.getSceneGroup().detach();
        drums.animateCymbals("HihatOpen");
        Screen.getObjectRoot().addChild(drums.getSceneGroup());
    }
    /**
     * plays Sound for Snare
     */
    public static void playRacktom() {
        s.playSound(7);
    }
    /**
     * plays Sound for Snare
     */
    public static void playFloortom() {
        s.playSound(8);
    }
    
    
}
